insheet using waroutcomes.csv

* Mindless renaming of variables to make Stata happy

ren s S
ren w W
ren w_mod W_mod
ren opps oppS
ren oppw oppW
ren oppw_mod oppW_mod
ren effectives effectiveS
ren effectiveopps effectiveoppS
ren effectives_mod effectiveS_mod
ren effectiveopps_mod effectiveoppS_mod

gen bimodalW = 0
replace bimodalW = 1 if W >= .75

* The next line produces Table 9.4

tab2 bimodalW territoryalt if droppedcase == 0 &  nofighting == 0 & minorwardyad == 0, all row exact

* The next line adds minor war cases to Table 9.4 as discussed in fn. 19.

tab2 bimodalW territoryalt if droppedcase == 0 &  nofighting == 0, all row exact

* Generate power differential variables

gen powerdiff = 2
replace powerdiff = 1 if powerratio < .4
replace powerdiff = 3 if powerratio > .6
gen weaker = powerdiff
replace weaker = 0 if powerdiff == 2
replace weaker = 0 if powerdiff == 3
gen stronger = 4 - powerdiff
replace stronger = 0 if powerdiff == 2
replace stronger = 0 if powerdiff == 1

* Next line produces Table 9.5

tab2 stronger territoryalt if droppedcase == 0 & nofighting == 0 & minorwardyad == 0 & bimodalW == 0, all exact row

* Next line varies Table 9.5 by adding in minor war cases; the relationship
* remains strong as with Table 9.4

tab2 stronger territoryalt if droppedcase == 0 & nofighting == 0 & bimodalW == 0, all exact row

* The next lines generate a test that Bruce cut from the book.  Small W should
* take territory that generates more resources that large W systems.  We measure
* value by population * population density, using the idea that highly populated
* areas are more productive.  The test is a t-test in the difference in means
* of the log of value of the territory between small and large W systems.
 
mvdecode areaofunitinkilometerssquared populationofunit, mv(-9)
gen valueofterritory = log((populationofunit^2)/ areaofunitinkilometerssquared)
ttest valueofterritory if territory == 1, by(bimodalW)

* The next line produces Table 9.6

tab2 bimodalW leaderchange if droppedcase == 0 &  nofighting == 0 & minorwardyad == 0, all row exact

gen verysmallW = 0
replace verysmallW = 1 if W < .5
gen bimodaloppW = 0
replace bimodaloppW = 1 if oppW >= .75
gen verysmalloppW = 0
replace verysmalloppW = 1 if oppW < .5

* The next table was dropped from book; leaders with very small winning coalitions
* are very unlikely to remove enemy leaders.

tab2 verysmallW leaderchange if droppedcase == 0 &  nofighting == 0 & minorwardyad == 0, all row exact

* The next line generates Table 9.7a

tab2 bimodaloppW leaderchange if droppedcase == 0 &  nofighting == 0 & minorwardyad == 0 & verysmallW == 0, all row exact

* The next line generates Table 9.7b

tab2 verysmalloppW leaderchange if droppedcase == 0 & nofighting == 0 & minorwardyad == 0 & verysmallW == 0, all row exact

clear
exit
